//const router = require('koa-router')()
//const mysql = require('mysql')
//function __connection() {
//    var connection = mysql.createConnection({
//        host: '192.168.1.112',
//        user: 'yzy',
//        password: '20010206',
//        database: 'car'
//    });
//    connection.connect();
//    return connection;
//}
//const query = function (sql, parmas = null) {
//    //1.获取数据库连接对象
//    var connection = __connection();
//    return new Promise(function (resolve, reject) {
//        //2执行sql语句
//        connection.query(sql, parmas, function (error, results, fields) {
//            if (error) throw error;
//            resolve(results);
//        });
//        //3关闭连接
//        connection.end();
//    })
//}
//
//
//router.get('/title', async (ctx, next) => {
//    const result = await query('select * from title');
//    console.log(result)
//    ctx.body = result
//})
//router.get('/datalist', async (ctx, next) => {
//    const result = await query('select * from datalist');
//    console.log(result)
//    ctx.body = result
//})
//module.exports = router
